package com.jichangxiu.framework.factory;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.jichangxiu.framework.service.DynamicService;
import com.jichangxiu.framework.service.impl.DefaultDynamicServiceImpl;

public class DynamicFactory {

    public static DynamicService dynamicService() {
        DynamicService dynamicService;
        try {
            dynamicService = SpringUtil.getBean(DynamicService.class);
            if (ObjectUtil.isEmpty(dynamicService))
                dynamicService = new DefaultDynamicServiceImpl();
        } catch (Exception exception) {
            dynamicService = new DefaultDynamicServiceImpl();
        }
        return dynamicService;
    }

}
